<%--
  Created by IntelliJ IDEA.
  User: 张荣荣
  Date: 2022/4/6
  Time: 14:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<html>
<head>
    <meta charset="UTF-8">
    <title>神行租车</title>
    <link href="${pageContext.request.contextPath}/css/order_add_review.css" rel="stylesheet">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/layui.css">
    <link rel="shortcut icon" href="${pageContext.request.contextPath}/image/smallLogo.svg" type="image/x-icon">
    <script src="${pageContext.request.contextPath}/js/jquery-3.6.0.min.js"></script>
    <script src="${pageContext.request.contextPath}/layui/layui.js"></script>
</head>
<body>
<%--${Order}--%>
${Car}
<!--===============================================头部===================================-->
<%--<div class="header" >--%>
<%--    <div class="header-box">--%>
<%--        <a href="" class="top-logo"><img src="${pageContext.request.contextPath}/image/logo.svg" alt=""></a>--%>
<%--        <div class="login-box">--%>
<%--                    <span id="spanLogin">--%>
<%--                        <a href="" id="Login">登录</a>--%>
<%--                         <span>|</span>--%>
<%--                        <a href="" id="Register">免费注册</a>--%>
<%--                    <span>|</span>--%>
<%--                    <a href="">我的一嗨</a>--%>
<%--                        </span>--%>
<%--        </div>--%>
<%--    </div>--%>
<%--</div>--%>
<jsp:include page="../common/head.jsp"/>


<!--=======================================评价订单=========================-->
<div class="orderinfo">
    <h3 class="o-title">评价订单</h3>
    <div class="o-info">
        <span>订单号:</span><span id="orderId">${Order.myorderNumber}</span>
        <span>${Order.myorderDate}

            <fmt:formatDate value="${Order.myorderDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
        </span>
    </div>
</div>

<!--=========================================服务评分===============================-->
<div class="score" >
    <span class="score-title">服务评价</span>

    <div class="fenge1"></div>

    <div class="score-info">
        <div class="score-star">
            <span>店铺服务</span>
            <div id="test6"></div>

        </div>

        <div class="score-star">
            <span>车辆满意度</span>
            <div id="test7"></div>
        </div>

        <div class="score-star">
            <span>平台满意度</span>
            <div id="test8"></div>
        </div>

    </div>
</div>
<!--========================================评价晒单=============================-->
<div class="evaluation">
    <div class="fenge2"></div>
    <div class="fenge3"></div>
    <div class="evaluation-order-info">
        <div class="evaluation-img">
            <img src="${pageContext.request.contextPath}${Car.carImage}">
        </div>
        <div class="evaluation-car-info">
            <a href="${pageContext.request.contextPath}/car/${car.carId}">${Car.carBrand}${Car.carName}</a>
            <span>租 期: <span class="day">${Order.carDay}</span>天</span>
            <span>￥</span> <span>${Order.myorderTotalPrice}</span>
        </div>
    </div>

    <div class="car-experience">

        <div class="experience-score-star">
            <span class=" experience">租车体验</span>
            <div id="test9"></div>
        </div>
    </div>
    <div class="review">
        <div class="show-review">评价晒单</div>
        <div class="write-review">
            <textarea name="" id="write" cols="30" rows="10"></textarea>
        </div>
    </div>

</div>

<div class="f-btnbox">
    <a id="showtest" href="javascript:void(0)" > 发表</a>
</div>

<script src="${pageContext.request.contextPath}/js/order_add_review.js" charset="utf-8"></script>


</body>
</html>

<script>
    $(document).ready(function(){
        $("#showtest").click(function(){
            var shop_score = $("#test6").text();
            console.log(shop_score);

            var car_score = $("#test7").text();
            console.log(car_score);

            var part_score = $("#test8").text();
            console.log(part_score);

            var test_score = $("#test9").text();
            console.log(test_score);
            var write = $("#write").val();
            console.log(write);

            var cusId = '${customer.memberId}'
            console.log("cusId：" + cusId)

            var orderId =$("#orderId").text();
            console.log("orderId：" + orderId)

            var carId =$("#carId").text();
            console.log("carId：" + carId)

            var shopId =$("#shopId").text();
            console.log("shopId：" + shopId)

            var score =(Number(shop_score)+Number(car_score)+Number(part_score)+Number(test_score))/4;
            score = score.toFixed(1);
            console.log("score：" + score)
            var newurl ='${pageContext.request.contextPath}/addReview?'+'cusId='+cusId+'&orderId='+orderId+'&score='+score+
                '&write='+write+'&carId='+`${Order.carId}`+'&shopId='+`${Order.getShopId}`;
            console.log(newurl)
            window.location.href = newurl;
        });
    });



</script>
